package com.xinqi.common.core.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.xinqi.common.base.enums.BaseEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * chatGPT消息角色
 *
 * @version V1.0
 * @Title:
 * @ClassName: com.xinqi.common.core.enums.ChatGptRoleEnum.java
 * @Description:
 * @Copyright 星齐科技（云南）有限公司 - Powered By 技术部
 * @author: yyzhen
 * @date: 2023/5/31 9:11
 */
public enum ChatGptMessageTypeEnum implements BaseEnum {

    /**
     * 一次输出
     */
    MESSAGE("message", "一次输出"),

    /**
     * 流输出类型
     */
    STREAM("stream", "流输出类型");

    @Getter(onMethod_ = {@JsonValue})
    private final String code;

    @Getter
    private final String describe;

    ChatGptMessageTypeEnum(String code, String describe) {
        this.code = code;
        this.describe = describe;
    }

    @JsonCreator
    public static ChatGptMessageTypeEnum of(String code) {
        return BaseEnum.of(ChatGptMessageTypeEnum.class, code);
    }

    public static List<Map<String, String>> getSelectList() {
        List<Map<String, String>> list = new ArrayList<>();
        for (ChatGptMessageTypeEnum typeEnum : ChatGptMessageTypeEnum.values()) {
            Map<String, String> map = new HashMap<>();
            map.put("code", typeEnum.getCode());
            map.put("describe", typeEnum.getDescribe());
            list.add(map);
        }
        return list;
    }

}
